var InjectHelper = {
    // 注入Html
    addInjectHtmlString: function (node, html) {
        if (html != null && node != null) {
            const div = document.createElement('div');
            div.innerHTML = html;
            if (div.firstChild != null) {
                node.append(div.firstChild);
            }
        }
    },
    // 注入脚本
    addInjectScript: function (src, onLoadCallback = null, isLocal = true) {
        let jsElement = document.createElement('script');
        jsElement.setAttribute('type', 'text/javascript');
        jsElement.setAttribute('charset', 'utf-8');
        jsElement.src = isLocal ? chrome.runtime.getURL(src) : src;
        jsElement.onload = onLoadCallback
        document.head.appendChild(jsElement);
    },

    // 注入CSS
    addInjectCss: function (src, onLoadCallback) {
        let linkElement = document.createElement('link');
        linkElement.type = 'text/css';
        linkElement.rel = 'stylesheet';
        linkElement.href = chrome.runtime.getURL(src);;
        linkElement.onload = onLoadCallback
        document.head.appendChild(linkElement);
    }
};
InjectHelper.__proto__ = {}
// console.log('===>>InjectHelper')